var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var UI_EventView_UIBindings = require("AA_UI_EventView_UIBindings");
var UIView = require("AA_UIView");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;

var _def_UI_EventView = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.auto_ui = null;
    t.btnSpriteFrames = [];
    return t;
  }
  __extends(_creator, e);
  _creator.prototype._show = function (e) {
    if (e.titleStr) {
      this.auto_ui.txt_tipLabel.string = e.titleStr;
    } else {
      this.auto_ui.txt_tipLabel.string = "提示";
    }
    var t;
    var o = this.auto_ui.node_btnFather;
    this.eventData = e;
    this.node.children[0].active = true;
    this.auto_ui.node_btnFather.children.forEach(function (e) {
      return e.active = false;
    });
    t = e && e.btnTypes ? e.btnTypes.length : 1;
    for (var n = 0; n < t; n++) {
      var i = undefined;
      if (n < o.childrenCount) {
        i = o.children[n];
      } else {
        (i = cc.instantiate(this.auto_ui.node_btnItem)).parent = this.auto_ui.node_btnFather;
        i.y = 0;
        var a = n;
        i.on(cc.Node.EventType.TOUCH_END, this.onClickOK.bind(this, a), this);
      }
      if (e.btnStrs) {
        i.getComponentInChildren(cc.Label).string = e.btnStrs[n];
      } else {
        i.getComponentInChildren(cc.Label).string = "知道了";
      }
      if (e.btnTypes && e.btnTypes[n] < this.btnSpriteFrames.length) {
        i.getComponent(cc.Sprite).spriteFrame = this.btnSpriteFrames[e.btnTypes[n]];
      } else {
        i.getComponent(cc.Sprite).spriteFrame = this.btnSpriteFrames[0];
      }
      if (e.haveVideoIcon && e.haveVideoIcon[n]) {
        i.children[0].x = 40;
        i.children[1].active = true;
      } else {
        i.children[0].x = 0;
        i.children[1].active = false;
      }
      i.active = true;
    }
    if (e.tipStr) {
      this.auto_ui.txt_tipLabel.string = e.tipStr;
    } else {
      this.auto_ui.txt_tipLabel.string = "";
    }
  };
  _creator.prototype.onClickOK = function (e) {
    this.eventData.clickFuncs && this.eventData.clickFuncs[e] && this.eventData.clickFuncs[e]();
    if (!(this.eventData.willCloses && !this.eventData.willCloses[e])) {
      this._close();
      this.eventData.clickFuncs = null;
    }
  };
  _creator.prototype._clickListener = function (e) {
    switch (e) {
      case this.auto_ui.btn_closeBtn:
        this._close();
    }
  };
  __decorate([_property(UI_EventView_UIBindings.default)], _creator.prototype, "auto_ui", undefined);
  __decorate([_property([cc.SpriteFrame])], _creator.prototype, "btnSpriteFrames", undefined);
  return __decorate([_ccclass], _creator);
}(UIView.default);
exports.default = _def_UI_EventView;